package com.example.lvsuo.controller;


import com.example.lvsuo.entity.HrWorkhistory;
import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.IHrWorkhistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 历史工作信息 前端控制器
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@RestController
@RequestMapping("/hrWorkhistory")
public class HrWorkhistoryController {
    @Autowired
    IHrWorkhistoryService iHrWorkhistoryService;

    /**
     * 查询律师员工历史工作经历
     * @param
     * @return
     */
    @GetMapping("/{id}")
    public Result getHrWorkhistory(@PathVariable String id){
        List<HrWorkhistory> hrWorkhistory = iHrWorkhistoryService.getHrWorkhistory(id);
        return Result.back("ok","200",hrWorkhistory) ;
    }

    /**
     * 添加历史工作经历
     * @param hrWorkhistory
     */
    @PostMapping("/{id}")
    public void insertHrWorkhistory(@RequestBody HrWorkhistory hrWorkhistory,@PathVariable Long id){
        hrWorkhistory.setHrEmpId(id);
        iHrWorkhistoryService.insertHrWorkhistory(hrWorkhistory);
    }

}

